package com

import android.content.Context
import android.text.TextUtils
import com.afollestad.materialdialogs.MaterialDialog
import com.example.zjx8969.myapplication.R

fun createLoadingDialog(context: Context, title: String?,
                        msgContent: String?, isCancelable: Boolean): MaterialDialog {
    return MaterialDialog(context).apply {
        if (!TextUtils.isEmpty(title)) title(text = title)
        if (!TextUtils.isEmpty(msgContent)) message(text = msgContent)
        cancelable(isCancelable)
/*        val process = ProgressBar(context).apply {
            indeterminateDrawable = ContextCompat.getDrawable(context, R.drawable.loading_anim)
        }*/
        view.contentLayout.addCustomView(res = R.layout.dialog_loading, view = null, scrollable = false, noVerticalPadding = true, horizontalPadding = true)

/*        negativeButton(text = "OK") {
            it.dismiss()
        }
        positiveButton(text = "Cancel") {

        }*/
    }

}
